const path = require("path");
const fs = require("fs");
const util = require("util");

let Filepath1 = path.join(__dirname, "files", "我.txt");
let Filepath2 = path.join(__dirname, "files", "爱.txt");
let Filepath3 = path.join(__dirname, "files", "node.js.txt");
let FilePath4 = path.join(__dirname, "files", "data.txt")

let readFilePromise = util.promisify(fs.readFile);
let writeFilePromise = util.promisify(fs.writeFile);


let p1 = readFilePromise(Filepath1);
let p2 = readFilePromise(Filepath2);
let p3 = readFilePromise(Filepath3);
Promise.all([p1, p2, p3]).then((data) => {
    //data里面以数组的形式存放p1,p2,p3
    let str1 = data.join("");
    writeFilePromise(FilePath4, str1);

}).catch((error) => {
    console.log(error);
})